package com.stone.base.entity;

import java.io.Serializable;
import java.util.List;

public class Page implements Serializable{
	
	private static final long serialVersionUID = -6896154521253993228L;
	//每页最大记录数限制
	public static final Integer MAX_PAGE_SIZE = 500;
	//当前页码
	private Integer pageCurrent = 1;
	//每页记录数
	private Integer pageSize = 10;
	//总记录数
	private Integer totalCount = 0;
	//总页数
	private Integer pageCount = 0;
	//结果集列表
	private List resultList = null;
	
	public Page(){}

	public Integer getPageCurrent() {
		return pageCurrent;
	}

	public void setPageCurrent(Integer pageCurrent) {
		if (pageCurrent < 1) {
			pageCurrent = 1;
		}		
		this.pageCurrent = pageCurrent;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		if (pageSize < 1) {
			pageSize = 1;
		} else if(pageSize > MAX_PAGE_SIZE) {
			pageSize = MAX_PAGE_SIZE;
		}		
		this.pageSize = pageSize;
	}

	public Integer getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(Integer totalCount) {
		this.totalCount = totalCount;
	}

	public Integer getPageCount() {
		pageCount = totalCount / pageSize;
		if (totalCount % pageSize > 0) {
			pageCount ++;
		}		
		return pageCount;
	}

	public void setPageCount(Integer pageCount) {
		this.pageCount = pageCount;
	}

	public List getResultList() {
		return resultList;
	}

	public void setResultList(List resultList) {
		this.resultList = resultList;
	}
}
